From: Richard M. Stallman Date: Thu, 6 May 1993 18:54:32 +0000 (+0000) Subject: (previous-matching-history-element): If minibuf is empty, X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~96379 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=c1172a195d9a325e5348a710bb36bafe4fc172b5;p=emacs.git (previous-matching-history-element): If minibuf is empty, use the last regexp specified a the default. (next-matching-history-element): Likewise. --- diff --git a/lisp/simple.el b/lisp/simple.el index a991481995d..db499b4f5a4 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -478,13 +478,18 @@ contains expressions rather than strings.") With prefix argument N, search for Nth previous match. If N is negative, find the next or Nth next match." (interactive - (let ((enable-recursive-minibuffers t) - (minibuffer-history-sexp-flag nil)) - (list (read-from-minibuffer "Previous element matching (regexp): " - nil - minibuffer-local-map - nil - 'minibuffer-history-search-history) + (let* ((enable-recursive-minibuffers t) + (minibuffer-history-sexp-flag nil) + (regexp (read-from-minibuffer "Previous element matching (regexp): " + nil + minibuffer-local-map + nil + 'minibuffer-history-search-history))) + ;; Use the last regexp specified, by default, if input is empty. + (list (if (string= regexp "") + (setcar minibuffer-history-search-history + (nth 1 minibuffer-history-search-history)) + regexp) (prefix-numeric-value current-prefix-arg)))) (let ((history (symbol-value minibuffer-history-variable)) prevpos @@ -518,13 +523,18 @@ If N is negative, find the next or Nth next match." With prefix argument N, search for Nth next match. If N is negative, find the previous or Nth previous match." (interactive - (let ((enable-recursive-minibuffers t) - (minibuffer-history-sexp-flag nil)) - (list (read-from-minibuffer "Next element matching (regexp): " - nil - minibuffer-local-map - nil - 'minibuffer-history-search-history) + (let* ((enable-recursive-minibuffers t) + (minibuffer-history-sexp-flag nil) + (regexp (read-from-minibuffer "Next element matching (regexp): " + nil + minibuffer-local-map + nil + 'minibuffer-history-search-history))) + ;; Use the last regexp specified, by default, if input is empty. + (list (if (string= regexp "") + (setcar minibuffer-history-search-history + (nth 1 minibuffer-history-search-history)) + regexp) (prefix-numeric-value current-prefix-arg)))) (previous-matching-history-element regexp (- n)))